#ifndef OUTPUTDEVICEWIDGET_H
#define OUTPUTDEVICEWIDGET_H

#include <QWidget>

#include "deviceobject.h"
#include "devicewidget_p.h"

class QCheckBox;
class QLayout;
class QHBoxLayout;
class QLabel;
class QRadioButton;
class QSlider;

class EndpointVolumeObject;

class DeviceWidget : public QWidget, public DeviceObject
	{
		Q_OBJECT

		public:
			explicit DeviceWidget(QWidget *parent = 0);
			~DeviceWidget();

			QString deviceName() const;

			EDataFlow deviceType() const
				{ return dvp->device_type; }

			bool editMode() const
				{ return edit_mode; }

			QStringList genSettings() const;

			bool isDefaultDevice() const;

			QCheckBox * muteBox()
				{ return mute_box; }

			QLayout * parentLayout()
				{ return (QLayout *) hbox_main; }

			QRadioButton * radioBtn()
				{ return radio_btn; }

			void setDevice(IMMDevice *);
			void setDeviceName(const QString &);

			void setDeviceType(EDataFlow type)
				{ dvp->device_type = type; }

			void setLocked(bool);

		protected:
			void paintEvent(QPaintEvent *);

		private:
			DeviceWidgetPrivate * dvp;
			bool edit_mode;
			QLabel * device_name_label;
			QHBoxLayout * hbox_main;
			QCheckBox * lock_box;
			QCheckBox * mute_box;
			QRadioButton * radio_btn;
			EndpointVolumeObject * vol_object;
			QSlider * vol_slider;

		public slots:
			void mute(bool);
			void setAsDefaultDevice();
			void setEditMode(bool x);
			void setSliderPosition(int);
			void setVolume(int);
			void syncMute();
			void syncVolume();
			void updateVolume();

		signals:
			void muteToggled(bool);
			void volumeAdjusted(int);
	};

#endif // OUTPUTDEVICEWIDGET_H
